useJobs.ts ➔ getJobs   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
1
import { useQuery } from "@tanstack/react-query"
2
3
export async function getJobs() {
4
  return await fetch("/api/fetchNavJobs").then((result) =>
5
    result.json().then((data) => {
6
      return data
7
    }),
8
  )
9
}
10
11
const useJobs = () => {
12
  const { data, isLoading } = useQuery({
13
    queryKey: ["jobs"],
14
    queryFn: getJobs,
15
  })
16
  return { data, isLoading }
17
}
18
19
export default useJobs
20